<?php

abstract class SourceAdapter {
   
   protected $mCategories;
   protected $age;
   protected $gender;
   protected $income;
   protected $occupation;
   protected $interest1;
   protected $interest2;
   protected $interest3;
   
   // Force Extending class to define this method;
   
   // Match the Profile of the user to an Ad
   abstract protected function matchProfile();
   
   // Generate the URL and Retrieve the Ad Source/XML
   abstract protected function retrieveSource();
   
   // Get the HTML output of the Source
   abstract protected function getHTML();
   
   // Update the database profile of the user;
   abstract protected function updateProfile();
   
   // Common method
   public function retrieveProfile($dbc, $id) {
		echo 'In retrieveProfile in SourceAdapter';
		$query = "SELECT * FROM `clients` WHERE `id`='$id'";
		$r = mysqli_query ($dbc, $query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysqli_error($dbc));
		
		if (@mysqli_num_rows($r) == 1)
		{
			$row = $r->fetch_assoc();

			$this->age = $row['age'];
			$this->gender = $row['gender']; // MALE = 0 , FEMALE = 1
			$this->income = $row['income'];
			$this->occupation = $row['occupation'];
			$this->interest1 = $row['interest1'];
			$this->interest2 = $row['interest2'];
			$this->interest3 = $row['interest3'];

			}
	}
}

?>